home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / BorderPanel.java < prev    next >
Text File  |  1998-10-03  |  2KB  |  73 lines

  1. package com.symantec.itools.frameworks.wizard;
  2.  
  3.  
  4. import com.sun.java.swing.JPanel;
  5. import java.awt.Insets;
  6. import java.awt.Color;
  7. import com.sun.java.swing.JComponent;
  8. import java.awt.BorderLayout;
  9. import java.awt.Graphics;
  10. import java.awt.Dimension;
  11.  
  12.  
  13. /**
  14.  * @author Symantec Internet Tools Division
  15.  * @version 1.0
  16.  * @since VCafe 3.0
  17.  */
  18.  
  19. public class BorderPanel extends JComponent
  20. {
  21.     public BorderPanel(JComponent borderThis, int leftBorder,
  22.                        int rightBorder, int topBorder,
  23.                        int bottomBorder, Color fillColor)
  24.     {
  25.         setLayout(new BorderLayout());
  26.         add(borderThis, "Center");
  27.         inset = new Insets(topBorder, leftBorder, bottomBorder, rightBorder);
  28.         color = new Color(fillColor.getRGB());
  29.     }
  30.  
  31.     public BorderPanel(JComponent borderThis, Insets inset, Color fillColor)
  32.     {
  33.         setLayout(new BorderLayout());
  34.         add(borderThis, "Center");
  35.         this.inset = (Insets) inset.clone();
  36.         color = new Color(fillColor.getRGB());
  37.     }
  38.  
  39.     /**
  40.      * @since VCafe 3.0
  41.      */
  42.     public Insets getInsets()
  43.     {
  44.         return inset;
  45.     }
  46.  
  47.     /**
  48.      * @param g TODO
  49.      * @since VCafe 3.0
  50.      */
  51.     public void paint (Graphics g)
  52.     {
  53.         Dimension mySize = getSize();
  54.         g.setColor(color);
  55.         // Top inset
  56.         g.fillRect(0, 0, mySize.width, inset.top);
  57.  
  58.         // Left inset
  59.         g.fillRect(0, 0, inset.left, mySize.height);
  60.  
  61.         // right inset
  62.         g.fillRect((mySize.width - inset.right), 0, inset.right, mySize.height);
  63.  
  64.         // bottom inset
  65.         g.fillRect(0, (mySize.height - inset.bottom), mySize.width, mySize.height);
  66.  
  67.         super.paint(g);
  68.     }
  69.     private Insets inset = null;
  70.     private Color color = null;
  71. }
  72.  
  73.